import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
const store = new Vuex.Store({
  state: {
    token: window.sessionStorage.getItem("token")
      ? window.sessionStorage.getItem("token")
      : ""
  },
  mutations: {
    changeToken(state, token) {
      state.token = token;
      window.sessionStorage.setItem("token", state.token);
    }
  }
});

export default store;
